﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework
 * Version 2.10
 * 
 * CNR Error Code Interface Definition
 *      Provides a base type definition for representing a protocol error code.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using Adaptive.Foundation;

namespace Adaptive.Foundation.Network.Cnr
{
    /// <summary>
    /// Provides a base type definition for representing a protocol error code.
    /// </summary>
    public interface IErrorCode
    {
        /*--------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------*/
        #region Public Properties
        /// <summary>
        /// Gets or sets the description of the value being represented.
        /// </summary>
        /// <value>
        /// Description text or an empty string.
        /// </value>
        string Description { get; set; }
        /// <summary>
        /// Gets or sets a reference to any related data.
        /// </summary>
        /// <value>
        /// An object or <b>null</b>.
        /// </value>
        object RelatedData { get; set; }
        #endregion

        /*--------------------------------------------------------------------------------
         * Public Methods / Functions
         *------------------------------------------------------------------------------*/
        #region Public Methods / Functions
        /// <summary>
        /// Renders the error code as text.
        /// </summary>
        /// <returns>
        /// The error code as a text string.
        /// </returns>
        string Render();
        /// <summary>
        /// Renders the error code value itself.
        /// </summary>
        /// <returns>
        /// The error code value as a string.
        /// </returns>
        string RenderErrorCodeValue();
        /// <summary>
        /// Renders the error code object as text.
        /// </summary>
        /// <param name="renderer">
        /// The renderer used to render the text.
        /// </param>
        /// <returns>
        /// The error code and other data as a text string.
        /// </returns>
        string Render(CnrDataRendererBase renderer);
        /// <summary>
        /// Renders the error code as text.
        /// </summary>
        /// <param name="renderer">
        /// The renderer used to render the text.
        /// </param>
        /// <returns>
        /// The error code as a text string.
        /// </returns>
        string RenderErrorCodeValue(CnrDataRendererBase renderer);
        #endregion
    }
}